package com.softstao.guoyu.mvp.interactor;

import com.softstao.guoyu.global.APIInterface;
import com.softstao.guoyu.model.WechatLogin;
import com.softstao.guoyu.model.me.AgentId;
import com.softstao.guoyu.utils.MyHttpParams;

import rx.functions.Action1;

/**
 * Created by vaikus on 2017/6/13.
 */

public class LoginInteractor extends BaseInteractor {
    public void login(String username, String password, Action1<Object> action1){
        MyHttpParams params = new MyHttpParams("username",username,"password",password);
        builder.setAction(action1)
                .setUrl(APIInterface.LOGIN)
                .setType(AgentId.class)
                .getVolley()
                .post(params);
    }

    public void wechatLogin(String code,Action1<Object> action1){
        MyHttpParams params = new MyHttpParams("code",code);
        builder.setAction(action1)
                .setUrl(APIInterface.WEIXIN_LOGIN)
                .setType(WechatLogin.class)
                .getVolley()
                .post(params);
    }

    public void binding(String mobile,String openid,String password,Action1<Object> action1){
        MyHttpParams params = new MyHttpParams("mobile",mobile,"openid",openid,"password",password);
        builder.setAction(action1)
                .setUrl(APIInterface.WEIXIN_BINDING)
                .setType(WechatLogin.class)
                .getVolley()
                .post(params);
    }
}
